import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        String[] res=new String[t];
        for(int i=0;i<t;i++){
            String str=sc.next();
            if(str.length()%2==1){
                System.out.println(-1);
            }else if(str.length()==2){
                System.out.println("()");
            }else{
                System.out.println("There are multiple solutions");
            }
        }
    }
    public static void main2(String[] args) {
        Scanner sc=new Scanner(System.in);
        int T=sc.nextInt();
        int x=0;
        while(x<T){
            int a=sc.nextInt();
            int b=sc.nextInt();
            int k=a/b;
            int p=a%b;
            System.out.printf("%d=%d*%d+%d\n",a,k,b,p);
            x++;
        }
    }
    public static void main1(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        String str1=sc.next();
        int count=0;
        char[] ch=str.toCharArray();
        char[] ch1=str1.toCharArray();
        for(int i=0;i<ch.length;i++){
            if(ch[i]!=ch1[i]){
                ch[i+1]=ch[i+1]=='*'?'o':'*';
                count++;
            }
        }
        System.out.println(count);
    }
}